package com.qfmy.app.mapper.novel;

import com.qfmy.model.entity.novel.BookSelf;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.qfmy.app.mapper.novel
 * @date 2025/4/15
 * @description 书架
 */
@Mapper
@SuppressWarnings("all")
public interface BookSelfMapper {

    /**
     * 获取书架
     * @param userId
     * @param start
     * @param size
     * @return
     */
    List<BookSelf> getAll(Integer userId, int start, int size);

    /**
     * 删除书架
     * @param id
     * @param userId
     */
    @Delete("delete from book_self where id = #{id} and user_id = #{userId}")
    void deleteBookSelfById(Integer id, Integer userId);

    /**
     * 添加书架
     * @param bookSelf
     */
    @Insert("insert into book_self(user_id, book_id, add_time) values(#{userId}, #{bookId}, #{addTime})")
    void addBookSelf(BookSelf bookSelf);
}
